home *** CD-ROM | disk | FTP | other *** search
- /*
- | info.c Routine to display the informational window.
- */
-
- #include <stdlib.h>
- #include <intuition/intuition.h>
-
- /*----------------------------------------------------------------*/
- void info_show (char *title, BOOL warning, char *s1, char *s2, int seconds)
- /*
- | Displays the two given strings in a window with the given title
- | for the given number of seconds.
- | If warning is TRUE, the message is a warning and should be displayed
- | in a different colour.
- */
- {
- struct IntuiText text1, text2;
- struct NewWindow nwindow;
- struct Window *window = NULL;
- int len, len1, len2;
-
- text1.FrontPen = 1;
- text1.BackPen = 0;
- text1.DrawMode = JAM1;
- text1.LeftEdge = 16;
- text1.TopEdge = 7;
- text1.ITextFont = NULL;
- text1.IText = s1;
- text1.NextText = &text2;
-
- text2.FrontPen = 1;
- text2.BackPen = 0;
- text2.DrawMode = JAM1;
- text2.LeftEdge = 16;
- text2.TopEdge = 19;
- text2.ITextFont = NULL;
- text2.IText = s2;
- text2.NextText = NULL;
-
- nwindow.LeftEdge = 200;
- nwindow.TopEdge = 75;
- nwindow.Width = 200;
- nwindow.Height = 45;
- nwindow.DetailPen = -1;
- nwindow.BlockPen = -1;
- nwindow.Title = title;
- nwindow.Flags = ACTIVATE;
- nwindow.IDCMPFlags = 0;
- nwindow.Type = WBENCHSCREEN;
- nwindow.FirstGadget = NULL;
- nwindow.CheckMark = NULL;
- nwindow.Screen = NULL;
- nwindow.BitMap = NULL;
- nwindow.MinWidth = 0;
- nwindow.MinHeight = 0;
- nwindow.MaxWidth = 0;
- nwindow.MaxHeight = 0;
-
- if (warning)
- {
- text1.FrontPen = 3;
- text2.FrontPen = 3;
- }
- len = 20;
- len1 = strlen( s1 );
- len2 = strlen( s2 );
- if (len1 > len)
- len = len1;
- if (len2 > len)
- len = len2;
- if (len > 20)
- nwindow.Width = 40 + len * 8;
- if ((nwindow.LeftEdge + nwindow.Width) > 620)
- nwindow.Width = 620 - nwindow.LeftEdge;
-
- window = (struct Window *) OpenWindow (&nwindow);
- if (window == NULL) goto End;
-
- PrintIText (window->RPort, &text1, window->BorderLeft, window->BorderTop);
- ScreenToFront( window->WScreen );
-
- sleep (seconds);
- CloseWindow (window);
-
- End:
- }